import service from '@/utils/fetch'

export default {
  prefix: `${service.product}/attr`,
  info(id) {
    let url = `${this.prefix}/info/${id}`
    return service.get( url, null)
  },
  save(data) {
    let url = `${this.prefix}/save`
    return service.post(url, data)
  },
  update(data) {
    let url = `${this.prefix}/update`
    return service.post(url, data)
  },
  saveOrUpdate(data) {
    let url = `${this.prefix}/${!data.attrId ? "save" : "update"}`
    return service.post(url, data)
  },
  getDataList(data, attrtype, catId) {
    let type = attrtype === 0 ? "sale" : "base";
    let url = `/product/attr/${type}/list/${!catId ? 0 : catId}`
    return service.get(url ,data)
  },
  remove(ids) {
    let url = `${this.prefix}/delete`
    return service.post(url, ids);
  }

}
